# Maintainer:
pkgname=py3-landlock
pkgver=1.0.0_pre4
_pkgver="${pkgver//_pre/.dev}"
pkgrel=2
pkgdesc="Python interface to the Landlock Linux Security Module"
url="https://github.com/Edward-Knight/landlock"
arch="all"
license="MIT"
makedepends="
	py3-flit-core
	py3-gpep517
	"
checkdepends="
	py3-pytest
	py3-pytest-cov
	py3-pytest-forked
	"
subpackages="$pkgname-pyc"
source="$pkgname-$_pkgver.tar.gz::https://github.com/Edward-Knight/landlock/archive/refs/tags/v$_pkgver.tar.gz"
builddir="$srcdir/landlock-$_pkgver"
options="!check" # needs landlock LSM loaded by kernel

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
40254d8c4bdac02daa7883705a55705087b9171ad2ed269bb29de8082ef7288755ac3a7f4f6a184b76b0c2786903057d08dc06244b0d126ee0bf57f9d90c0795  py3-landlock-1.0.0.dev4.tar.gz
"
